package com.yang.project.base.io;

import org.junit.Test;

import java.io.*;

public class InputStreamTest {
    /**
     * 测试使用字节流
     */
    @Test
    public void test() throws IOException {
        InputStream inputStream = new FileInputStream("D:\\temp.jpg");
        OutputStream outputStream = new FileOutputStream("D:\\temp2.jpg");
        int available = inputStream.available();
        System.out.println("最大字节数：" + available);
        byte[] bytes = new byte[1024];
        while (inputStream.read(bytes) != -1) {
            outputStream.write(bytes);
        }
        outputStream.flush();
    }
}
